fix(CodeBlock): handle ReactNode children with angle-bracket placeholders#950
Open
mneedham wants to merge 7 commits into
Open
fix(CodeBlock): handle ReactNode children with angle-bracket placeholders#950mneedham wants to merge 7 commits into
mneedham wants to merge 7 commits into
Conversation
…ders JSX parses <placeholder> style content as React elements, causing SyntaxHighlighter to receive objects instead of strings and render [object Object]. Accept ReactNode children and stringify them, reconstructing <tag> syntax for element nodes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 340a954 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
punkbit
suggested changes
Mar 25, 2026
Contributor
punkbit
left a comment
There was a problem hiding this comment.
@mneedham thanks for your contribution, mind add the missing changeset? Check https://github.com/clickHouse/click-ui?tab=readme-ov-file#add-a-new-changeset
…use#952) * chore: 🤖 make circular dependency check on commit as opt-in * refactor: 💡 make input not expected * docs: 📝 how to opt-in for circular-dependency * chore: 🤖 remove line break * chore: 🤖 add note about redirecting stdin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
childrenprop type fromstringtoReactNodeinCodeBlock.types.tsnodeToString()helper that recursively convertsReactNodeto a plain string, reconstructing<tag>syntax for React element nodeschildrenas a string now go throughnodeToString(children)Problem
When code content contains
<placeholder>style text (e.g. shell scripts with<project_id>,<email>), JSX parses those as React elements rather than raw text.SyntaxHighlighterthen receives objects instead of a string and renders[object Object]throughout the block.Test plan
<placeholder>style content and verify it renders literally$VARIABLEstyle content still renders as-is🤖 Generated with Claude Code
Note
Low Risk
Localized UI component change with backward-compatible string children; minor public API widening and dev-hook behavior only.
Overview
CodeBlock now accepts
ReactNodechildren and normalizes them with a newnodeToString()helper before syntax highlighting and clipboard copy, so angle-bracket placeholders (e.g.<project_id>) that JSX would otherwise turn into elements no longer show as[object Object]. Copy/onCopyuse the same plain-text string. Unit tests cover literals,$VAR, placeholders, and copy behavior. A minor changeset documents the package fix.Pre-commit circular dependency checks run only when
RUN_DEPS_CHECK=1(README tip added). The skott script redirects stdin from/dev/nullto reduce reported hangs on macOS.Reviewed by Cursor Bugbot for commit 340a954. Bugbot is set up for automated code reviews on this repo. Configure here.